<%-- 
    Document   : VerReservaRM
    Created on : 21/07/2008, 07:03:01 PM
    Author     : Alejandro
--%>

<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="com.akcess.vo.*" %>
<%@ page language="java" import="com.akcess.impl.*" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page language="java" import="manejadores.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <!--  Version: Multiflex-3.12 / Overview                    --><!--  Date:    January 20, 2008                             --><!--  Design:  www.1234.info                                --><!--  License: Fully open source without restrictions.      --><!--           Please keep footer credits with the words    --><!--           "Design by 1234.info" Thank you!             -->
        <script language="JavaScript">	
            <!--            
            function nuevoAjax(){
                var xmlhttp=false;
                try {
                    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (E) {
                        xmlhttp = false;
                    }
                }
        
                if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                    xmlhttp = new XMLHttpRequest();
                }
                return xmlhttp;
            } 
            function cargarContenido(){
                var cadena,t1,contenedor;
                contenedor = document.getElementById('ListaReservas');
                t1 = document.getElementById('TipoReserva').value;
                ajax=nuevoAjax();
                ajax.open("GET", "GestionarReservas?hacer=ListarReservas&id="+t1,true);
                ajax.onreadystatechange=function() {
                    if (ajax.readyState==4) {
                        cadena=ajax.responseText                        
                        contenedor.innerHTML = cadena
                    }
                }
                ajax.send(null)
            } 
        
            //-->
        </script>
        
        
        <base href="<%=basePath%>">
        <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout4_setup.css">
        <link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout4_text.css">
        <link rel="icon" type="image/x-icon" href="./img/favicon.ico">
        <title>SRR - Sistema de Reserva de Recursos</title><!-- Global IE fix to avoid layout crash when single word size wider than column width --><!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]-->
        <link href="./css/highlighter.css" type="text/css" rel="stylesheet">
        <link href="./css/highlighter_002.css" type="text/css" rel="stylesheet">
    </head>
    <body>
        <!-- Main Page Container -->
        <div class="page-container">
            
            <!-- For alternative headers START PASTE here -->

 <jsp:include page="../Header.jsp"/>
        
        <!-- For alternative headers END PASTE here -->

            <!-- B. MAIN -->
            <div class="main">
                
                <jsp:include page="../barraOperaciones.jsp"/>  
                
                <!-- B.2 MAIN CONTENT -->
                <div class="main-content">  
                    <!-- Pagetitle -->
                   <%
            out.println("<h1 class=\"pagetitle\"> Reserva a nombre de : " + request.getParameter("NombreSolicitante") + "</h1>");
            Connection cone;
            cone = (Connection) session.getAttribute("conexion");
            int idReserva = Integer.parseInt(request.getParameter("id"));
            int idTipo = Integer.parseInt(request.getParameter("tipoRM"));
            ManejadorReservas manejador = new ManejadorReservas(cone);
            Recurso_movil reserva = manejador.ObtenerReservaRM(idTipo,idReserva);
            ManejadorUbicaciones managerUbi = new ManejadorUbicaciones(cone);
            Ubicacion ubi = managerUbi.ObtenerUbicacion(reserva.getId_ubicacion());

            out.println("<table border=\"0\">");
            out.println("<tbody>");
            out.println("<th class=\"top\"><b>Solicitante</b> </th>");
            out.println("<td aling=\"center\">" + reserva.getNombreoperativo() + " " + reserva.getApellido() + "</td>");
            out.println("</tr>");

            out.println("<th class=\"top\"><b>Cancelada</b> </th>");
            if (reserva.getCancelada()) {
                out.println("<td>Si</td> ");
            } else {
                out.println("<td>No</td> ");
            }
            out.println("</tr>");

            if (reserva.getNombre() != null) {
                out.println("<tr>");
                out.println("<th class=\"top\"><b>Recurso</b> </th>");
                out.println("<td aling=\"center\">" + reserva.getNombre() + "</td>");
                out.println("</tr>");
            } else {
                out.println("<tr>");
                out.println("<th class=\"top\"><b>Recurso</b> </th>");
                out.println("<td aling=\"center\">No tiene nombre</td>");
                out.println("</tr>");
            }

            if (ubi.getNombre() != null) {
                out.println("<tr>");
                out.println("<th class=\"top\"><b>Ubicacion</b> </th>");
                out.println("<td aling=\"center\">" + ubi.getNombre() + "</td>");
                out.println("</tr>");
            } else {
                out.println("<tr>");
                out.println("<th class=\"top\"><b>Ubicacion</b> </th>");
                out.println("<td aling=\"center\">No tiene</td>");
                out.println("</tr>");
            }
            
            out.println("<th class=\"top\"><b>Capacidad</b> </th>");
            out.println("<td aling=\"center\">" + ubi.getCapacidad() + "</td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Fecha de Reserva</b> </th>");
            out.println("<td aling=\"center\">" + reserva.getFecha_reserva().toString() + "</td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Hora de Inicio</b> </th>");
            out.println("<td aling=\"center\">" + reserva.getHorainicio_asignada().toString().substring(0, 5) + "</td>");
            out.println("</tr>");

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Hora de Fin</b> </th>");
            out.println("<td aling=\"center\">" + reserva.getHorafin_asignada().toString().substring(0, 5) + "</td>");
            out.println("</tr>");        

            out.println("<tr>");
            out.println("<th class=\"top\"><b>Nombre Responsable</b> </th>");
            out.println("<td aling=\"center\">" + reserva.getNombre_responsable() + "</td>");
            out.println("</tr>");                                  
            
            out.println("<tr>");
            out.println("<th class=\"top\"><b>Nro. Doc. Responsable</b> </th>");
            out.println("<td aling=\"center\">" + reserva.getC_i_responsable() + "</td>");
            out.println("</tr>");        
            
            out.println("</tbody>");
            out.println("</table>");
            if(Boolean.parseBoolean(request.getParameter("mis"))){
                out.println("<a href=\"GestionarReservas?hacer=Listar_Mis\">Ir atras</a>");
            }else{
                out.println("<a href=\"GestionarReservas?hacer=Listar\">Ir atras</a>");
            }
                                %>
                    </tbody>
                    </table>          
                    <div id="ListaReservas">
                        
                    </div>
                    
                    
                    <!-- B.3 SUBCONTENT -->
                </div>
            </div>
            <!-- C. FOOTER AREA -->   
                <%@include file="../footer.jsp"%> 
        </div>
    </body>
</html>
